package com.crm.entity;

import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;

import org.hibernate.annotations.DynamicInsert;
import org.hibernate.annotations.DynamicUpdate;

@Entity
@Table(name="dynamicmessages")
@DynamicUpdate
@DynamicInsert
public class Dynamicmessages {
@Id
@GeneratedValue(strategy=GenerationType.IDENTITY)
private Integer did;//消息Id
@ManyToOne(fetch=FetchType.EAGER)
@JoinColumn(name="startId")
private User user1;//发起者
private String messageContent;//消息内容
private String isReply;//是否回复
private String createTime;//消息创建时间
private String backContent;//回复内容
@ManyToOne(fetch=FetchType.EAGER)
@JoinColumn(name="receiveId")
private User user2;//收到者
public Dynamicmessages() {
	super();
}
public Dynamicmessages(Integer did, User user1, String messageContent, String isReply, String createTime,
		String backContent, User user2) {
	super();
	this.did = did;
	this.user1 = user1;
	this.messageContent = messageContent;
	this.isReply = isReply;
	this.createTime = createTime;
	this.backContent = backContent;
	this.user2 = user2;
}
public Integer getDid() {
	return did;
}
public void setDid(Integer did) {
	this.did = did;
}
public User getUser1() {
	return user1;
}
public void setUser1(User user1) {
	this.user1 = user1;
}
public String getMessageContent() {
	return messageContent;
}
public void setMessageContent(String messageContent) {
	this.messageContent = messageContent;
}
public String getIsReply() {
	return isReply;
}
public void setIsReply(String isReply) {
	this.isReply = isReply;
}
public String getCreateTime() {
	return createTime;
}
public void setCreateTime(String createTime) {
	this.createTime = createTime;
}
public String getBackContent() {
	return backContent;
}
public void setBackContent(String backContent) {
	this.backContent = backContent;
}
public User getUser2() {
	return user2;
}
public void setUser2(User user2) {
	this.user2 = user2;
}
@Override
public String toString() {
	return "Dynamicmessages [did=" + did + ", user1=" + user1 + ", messageContent=" + messageContent + ", isReply="
			+ isReply + ", createTime=" + createTime + ", backContent=" + backContent + ", user2=" + user2 + "]";
}



}
